import { PageData } from '@/types/resp'
import request from '@/utils/request'
import {
  Weibo,
  WeiboPageParam,
  WeiboSaveOrUpdateParam,
  WeiboPushParam,
  WeiboRemoveParam,
  WeiboTopParam,
} from '@/types'

export const page = (param: WeiboPageParam): Promise<PageData<Weibo>> => {
  return request({
    url: '/weibo/page',
    method: 'post',
    data: param,
  })
}

export const saveOrUpdate = (param: WeiboSaveOrUpdateParam): Promise<PageData<Weibo>> => {
  return request({
    url: '/weibo/saveOrUpdate',
    method: 'post',
    data: param,
  })
}

export const push = (param: WeiboPushParam): Promise<unknown> => {
  return request({
    url: '/weibo/push',
    method: 'post',
    data: param,
  })
}

export const remove = (param: WeiboRemoveParam): Promise<unknown> => {
  return request({
    url: '/weibo/remove',
    method: 'post',
    data: param,
  })
}

export const top = (param: WeiboTopParam): Promise<unknown> => {
  return request({
    url: '/weibo/top',
    method: 'post',
    data: param,
  })
}
